home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / ObjectTcl-1.1 / CdlFile.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-30  |  5.0 KB  |  148 lines

  1. #ifndef CDL_FILE
  2. #define CDL_FILE
  3.  
  4. /*  _ __ ___ _
  5.  * | |\ /  /| |  $Id: CdlFile.H,v 1.6 1995/06/16 13:03:45 deans Exp $
  6.  * | | /  / | |  Copyright (C) 1995 IXI Limited.
  7.  * |_|/__/_\|_|  IXI Limited, Cambridge, England.
  8.  *
  9.  * Component   : CdlFile.H
  10.  *
  11.  * Author      : Dean Sheehan (deans@x.co.uk)
  12.  *  
  13.  * Description : Header file for CdlFile class that models the CDL input file.
  14.  *
  15.  * License     :
  16.             Object Tcl License & Copyright
  17.             -----------------------------
  18.  
  19. IXI Object Tcl software, both binary and source (hereafter, Software) is copyrighted by IXI Limited (IXI), and ownership remains with IXI. 
  20.  
  21. IXI grants you (herafter, Licensee) a license to use the Software for academic, research and internal business purposes only, without a fee. Licensee may distribute the binary and source code (if required) to third parties provided that the copyright notice and this statement appears on all copies and that no charge is associated with such copies. 
  22.  
  23. Licensee may make derivative works. However, if Licensee distributes any derivative work based on or derived from the Software, then Licensee will (1) notify IXI regarding its distribution of the derivative work, and (2) clearly notify users that such derivative work is a modified version and not the original IXI Object Tcl distributed by IXI. IXI strongly recommends that Licensee provide IXI the right to incorporate such modifications into future releases of the Software under these license terms. 
  24.  
  25. Any Licensee wishing to make commercial use of the Software should contact IXI, to negotiate an appropriate license for such commercial use. Commercial use includes (1) integration of all or part of the source code into a product for sale or license by or on behalf of Licensee to third parties, or (2) distribution of the binary code or source code to third parties that need it to utilize a commercial product sold or licensed by or on behalf of Licensee. 
  26.  
  27. IXI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. IXI SHALL NOT BE LIABLE FOR ANY DAMAGES WHATSOEVER SUFFERED BY THE USERS OF THIS SOFTWARE. 
  28.  
  29. Copyright (C) 1995, IXI Limited 
  30.  
  31. By using or copying this Software, Licensee agrees to abide by the copyright law and all other applicable laws of England and the U.S., including, but not limited to, export control laws, and the terms of this license. IXI shall have the right to terminate this license immediately by written notice upon Licensee's breach of, or non-compliance with, any of its terms. Licensee may be held legally responsible for any copyright infringement that is caused or encouraged by Licensee's failure to abide by the terms of this license. 
  32.  
  33. Comments and questions are welcome and can be sent to
  34. otcl@x.co.uk 
  35.  
  36. For more information on copyright and licensing issues, contact: 
  37. Legal Department, IXI Limited, Vision Park, Cambridge CB4 4ZR,
  38. ENGLAND. 
  39.  
  40.  *
  41.  */
  42.  
  43. // System Includes
  44. #include <fstream.h>
  45.  
  46. // Tcl Includes
  47. #include <tcl.h>
  48.  
  49. // Forwrard Class Declarations
  50. class CdlItem;
  51. class CdlMethod;
  52.  
  53. // Public Defines
  54. #define MAX_ITEMS 20
  55. #define OTCL_PART_SUFFIX "_otcl"
  56. #define OTCL_CLASS_SUFFIX "_otclc"
  57. #define STATIC_FLAG "-static"
  58. #define DYNAMIC_FLAG "-dynamic"
  59. #define ABSTRACT_FLAG "-abstract"
  60. #define CDL_TRUE 1
  61. #define CDL_FALSE 0
  62.  
  63. class CdlFile
  64. {
  65. public:   // Public Constructor & Destructor
  66.  
  67.    CdlFile (char *name);
  68.  
  69.    ~CdlFile ();
  70.  
  71. public:  // Public Instance Methods
  72.  
  73.    // Returns 1 if OK, 0 o/w
  74.    int parse (void);
  75.  
  76.    // Returns 1 if OK, 0 o/w
  77.    int genHeader (char *name);
  78.    int genSource (char *name);
  79.  
  80. private:   // Private Instance Methods
  81.  
  82.    void rmvStdTclCmds (void);
  83.   
  84.    void addItemCmds (void);
  85.    void rmvItemCmds (void);
  86.  
  87.    void addMethodCmds (void);
  88.    void rmvMethodCmds (void);
  89.  
  90.    void addArgCmds (void);
  91.    void rmvArgCmds (void);
  92.  
  93.    void addRtnCmds (void);
  94.    void rmvRtnCmds (void);
  95.  
  96.    void genHeaderStart (ofstream &);
  97.    void genHeaderEnd (ofstream &);
  98.  
  99.    void genSourceStart (ofstream &);
  100.    void genSourceEnd (ofstream &);
  101.  
  102. public:   // Public Class Methods
  103.  
  104.    static int classCmd (ClientData, Tcl_Interp *, int, char *[]);
  105.  
  106.    static int constructorCmd (ClientData, Tcl_Interp *, int, char *[]);
  107.  
  108.    static int methodCmd (ClientData, Tcl_Interp *, int, char *[]);
  109.  
  110.    static int classMethodCmd (ClientData, Tcl_Interp *, int, char *[]);
  111.  
  112.    static int argCmd (ClientData, Tcl_Interp *, int, char *[]);
  113.  
  114.    static int rtnCmd (ClientData, Tcl_Interp *, int, char *[]);
  115.  
  116.    static int passCmd (ClientData, Tcl_Interp *, int, char *[]);
  117.  
  118. private:  // Private Instance Methods
  119.  
  120.    int newClass (int argc, char *argv[]);
  121.  
  122.    int constructor (int argc, char *argv[]);
  123.  
  124.    int method (int argc, char *argv[]);
  125.  
  126.    int classMethod (int argc, char *argv[]);
  127.  
  128.    int arg (int argc, char *argv[]);
  129.  
  130.    int rtn (int argc, char *argv[]);
  131.  
  132.    int pass (int argc, char *argv[]);
  133.  
  134. private:  // Private Instance Attributes
  135.  
  136.    CdlItem *item[MAX_ITEMS];
  137.    int noOfItems;
  138.  
  139.    CdlMethod *methodUnderConstruction;
  140.  
  141.    Tcl_Interp *interp;
  142.  
  143.    char *name;
  144. };
  145.  
  146. #endif // CDL_FILE_H
  147.  
  148.